<?php

namespace Ad;

use core\controller\baseController;
use common\Factory\Factory;

class AdController extends baseController {
    
    function __construct() {
        $redis = Factory::getServer('Redis');
        $redis && $redis->hIncrBy('ad_click_pv', date('Ymd', time()), 1);
    }
    
    /*
     * 点击入库
     */
    public function inputClick() {
        $from = $this->routeParams['from'];

        Factory::getServer('MqWriteLog')->connect();
        $inputClick = new \Ad\Logic\InputClick();
        $data = count($_POST) > 0 ? $_POST : $_GET;
        $result = $inputClick->insert($data, $from);
        Factory::getServer('MqWriteLog')->disConnect();
        
        $this->jsonReturn($result);
    }
}